Skip to content

Conversation

@kraenhansen
Copy link
Contributor

@kraenhansen kraenhansen commented Jul 1, 2025

Description

Merging this PR will:

  • Introduce a feature flag to gate the context menus

Checklist

  • New tests and/or benchmarks are included
  • Documentation is changed or added
  • If this change updates the UI, screenshots/videos are added and a design review is requested
  • I have signed the MongoDB Contributor License Agreement (https://www.mongodb.com/legal/contributor-agreement)

Motivation and Context

  • Bugfix
  • New feature
  • Dependency update
  • Misc

Open Questions

Dependents

Types of changes

  • Backport Needed
  • Patch (non-breaking change which fixes an issue)
  • Minor (non-breaking change which adds functionality)
  • Major (fix or feature that would cause existing functionality to change)

@kraenhansen kraenhansen self-assigned this Jul 1, 2025
@kraenhansen kraenhansen added no release notes Fix or feature not for release notes no-title-validation Skips validation of PR titles (conventional commit adherence + JIRA ticket inclusion) labels Jul 1, 2025
@kraenhansen kraenhansen force-pushed the kh/context-menu-feature-flag branch from d834fa9 to ce04745 Compare July 1, 2025 15:39
@kraenhansen kraenhansen requested review from gagik and gribnoysup July 1, 2025 15:39
@kraenhansen kraenhansen force-pushed the kh/context-menu-feature-flag branch from ce04745 to 4f5a9f5 Compare July 1, 2025 15:40
@kraenhansen kraenhansen marked this pull request as ready for review July 1, 2025 15:40
Copilot AI review requested due to automatic review settings July 1, 2025 15:40
@kraenhansen kraenhansen requested a review from a team as a code owner July 1, 2025 15:40
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR introduces a new enableContextMenus feature flag and updates various components to allow toggling context menu support at runtime.

  • Adds enableContextMenus to the preferences model and feature-flag metadata
  • Reads the new flag in the Home component and passes a disableContextMenus prop into the components provider
  • Updates the ContextMenuProvider and CompassComponentsProvider to respect the disabled setting

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/compass/src/app/components/home.tsx Import and read enableContextMenus preference, pass disableContextMenus into provider
packages/compass-preferences-model/src/feature-flags.ts Add enableContextMenus to the FeatureFlags type and metadata
packages/compass-context-menu/src/context-menu-provider.tsx Add disabled prop to gate event listeners when context menus are off
packages/compass-components/src/components/context-menu.tsx Propagate disabled through the wrapper consumer
packages/compass-components/src/components/compass-components-provider.tsx Add disableContextMenus prop and forward to ContextMenuProvider
Comments suppressed due to low confidence (4)

packages/compass-context-menu/src/context-menu-provider.tsx:21

  • There are no tests verifying that context menus are correctly disabled when disabled is true; consider adding unit tests for this behavior.
  disabled = false,

packages/compass-preferences-model/src/feature-flags.ts:29

  • New feature flag enableContextMenus is added but there’s no documentation or examples in the project README or API docs; please update documentation to reflect this flag.
  enableContextMenus: boolean;

packages/compass-components/src/components/compass-components-provider.tsx:38

  • [nitpick] The prop disableContextMenus introduces a double negative; consider using enableContextMenus (and passing through the positive flag) to improve readability.
  /**

packages/compass/src/app/components/home.tsx:36

  • The import path for usePreference seems incorrect; it should be imported from '@mongodb-js/compass-preferences-model/provider' to match other scoped packages.
import { usePreference } from 'compass-preferences-model/provider';

@kraenhansen kraenhansen merged commit b4604a6 into main Jul 2, 2025
76 of 81 checks passed
@kraenhansen kraenhansen deleted the kh/context-menu-feature-flag branch July 2, 2025 04:35
@kraenhansen
Copy link
Contributor Author

Merging with an unrelated failure on the smoke tests on RPM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no release notes Fix or feature not for release notes no-title-validation Skips validation of PR titles (conventional commit adherence + JIRA ticket inclusion)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants